package org.lt.resume.controller.subcompany;

import java.util.List;

import org.apache.struts2.json.annotations.JSON;
import org.lt.resume.service.subcompanyserviceInterface.SubCompanyServiceInterface;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

public class SearchSubCompanyForTableController extends ActionSupport{

	/****/
	private static final long serialVersionUID = 2174203676026820292L;

	private List items;

	private String name;
	
	private SubCompanyServiceInterface subCompanyService; 
	
	
	@Override
	public String execute() throws Exception {

		if(name.trim().equals("")) {
			items = subCompanyService.searchSubCompanyInfo(0);
		} else {
		   items = subCompanyService.seachSubCompanyInfoForTable(name);
		}
		return Action.SUCCESS;

	}

	@JSON(name="items")
	public List getItems() {
		return items;
	}

	public void setItems(List items) {
		this.items = items;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setSubCompanyService(SubCompanyServiceInterface subCompanyService) {
		this.subCompanyService = subCompanyService;
	}
	
}
